package com.daoxuan.flux.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Mono;

import java.time.Duration;

/**
 * @description:
 * @author: wangqinglin
 * @date: 2020/8/11 17:36
 */

@RestController
public class FluxController {
    @GetMapping("/flux/{latency}")
    public Mono<String> flux(@PathVariable int latency) {
        return Mono.just("Welcome to reactive ~")
                .delayElement(Duration.ofMillis(latency));
    }
}
